package com.example.Controller;

import com.example.Service.UserService;
import com.example.entity.PageResult;
import com.example.entity.vo.UsersVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/userT")
@CrossOrigin
public class UserControllerT extends  BaseController {

    @Autowired
    private UserService userService;

    @PostMapping("/list")
    public PageResult<UsersVo> list(@RequestBody UsersVo usersVo) {
        // 1. 自动处理分页参数
        startPageByPost(usersVo);

        // 2. 获取当前用户(可选)
        String username = getLoginUsername();
        System.out.println("当前用户: " + username);
//        UsersVo usersVo
        // 3. 查询数据
        List<UsersVo> list = userService.selectAllT(usersVo);

        // 4. 返回分页结果
        return getDataTable(list);

    }

}
